package com.bwie.parkdemo.adapter;

import android.support.annotation.NonNull;
import android.widget.TextView;

import com.bwie.parkdemo.BR;
import com.bwie.parkdemo.R;
import com.bwie.parkdemo.mvvm.model.entity.SelAllApplyEntity;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

public class SelAllApplyAdapter extends BaseQuickAdapter<Object, BaseViewHolder> {
    public static final int TYPE = 11;
    private int [] colores = {R.color.colorVisitor,R.color.colorPark,R.color.colorRepair};
    public SelAllApplyAdapter() {
        super(R.layout.item_selall_apply);
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, Object item) {
        SelAllApplyEntity.Values values = (SelAllApplyEntity.Values) item;
        helper.getDataBinding().setVariable(BR.entity,values);
        //type:访客0;车位1;维修2
        int color = colores[values.type];
        helper.getDataBinding().getRoot().findViewById(R.id.selall_applyitem_top)
                .setBackgroundColor(helper.itemView.getResources().getColor(color));
        TextView title = helper.getDataBinding().getRoot().findViewById(R.id.selall_applyitem_title);
        if (values.type == 0){
            title.setText("访客申请");
        }else if (values.type == 1){
            title.setText("车位申请");
        }else {
            title.setText("维修申请");
        }
    }
}
